home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / comsh17.arc / COMSH17.DOC < prev    next >
Encoding:
Text File  |  1985-06-03  |  84.3 KB  |  4,229 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                      Comsh
  8.                                      -----
  9.  
  10.  
  11.                              A Communications Shell
  12.                                     for the
  13.                                      IBM PC
  14.                                    Tandy 2000
  15.                             And a cast of thousands
  16.  
  17.  
  18.  
  19.                      Document Revision: 1.2 (July 15, 1984)
  20.                      Software Revision: 1.7 (July 11, 1984)
  21.  
  22.  
  23.                       Copyright 1984 by Charles McGuinness
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.           Section 1:      Introduction
  33.           Section 2:      Program Startup
  34.           Section 3:      Commands
  35.           Section 4:      Scripts
  36.           Section 5:      Use of Comsh with CIS
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                      - 1 -
  64.  
  65.  
  66.  
  67.  
  68.  
  69.           Introduction
  70.  
  71.  
  72.           Introduction:
  73.  
  74.           [Scope of this manual]
  75.  
  76.           This document is the COMSH *reference* manual;  it  attempts
  77.           to be complete, instead of breezy  or  tutorial  in  nature.
  78.           Support for this program -- including help, hints,  and  the
  79.           like --  can  be  found  in  the  Programmer's  SIG  on  the
  80.           CompuServe Information Service (page PCS158).
  81.  
  82.           [Introduction to COMSH]
  83.  
  84.           COMSH stands for "COMmunications  SHell".   The  flavor  and
  85.           nature of COMSH is derrived from the  UNIX(tm)  environment,
  86.           but it has been adapted  to  a  communications  environment.
  87.           There are roughly two things COMSH tries to do:
  88.  
  89.                (1)  COMSH attempts to provide a  collection  of  tools
  90.                that  will  be  useful  while  communicating,  but  not
  91.                directly  relating  to   communications.    Thus,   for
  92.                example,  it  is  possible  to  search   and   retrieve
  93.                information from the computer COMSH is running on while
  94.                being logged into a remote computer.  This  allows  for
  95.                electronic note keeping, etc.
  96.  
  97.                (2)  COMSH attempts to provide a  collection  of  tools
  98.                that   are   directly   useful   in    automating    or
  99.                semi-automating communications with a remote host.  For
  100.                example, it is possible (and has  been  done!)  to  get
  101.                COMSH to  log  into  CompuServe,  visit  various  SIGs,
  102.                retrieve messages, post replies, and  log  off  --  all
  103.                without supervision.
  104.  
  105.           [Philosophy of operation]
  106.  
  107.           When you first invoke COMSH,  you  are  running  in  command
  108.           mode; COMSH expects you to tell it what  to  do.   What  you
  109.           type at that point is not sent to the modem; rather, COMSH
  110.           tries to interpret each line you type in  as  a  command  or
  111.           command sequence of some sort.
  112.  
  113.           One of the commands, "COM",  puts  you  into  communications
  114.           mode.  When you  are  in  communications  mode,  things  are
  115.           reversed from  command  mode.   COMSH  no  longer  tries  to
  116.           interpret you lines as commands; rather, each character  you
  117.           type is copied out to the modem immediately.  Only when  you
  118.           press one of the function keys  (or  shifted/alted  function
  119.           keys) does COMSH perk up and try to make sense of  your  key
  120.           stroke.
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                      - 2 -
  130.  
  131.  
  132.  
  133.  
  134.  
  135.                                                           Introduction
  136.  
  137.           The function keys under communications mode are assigned one
  138.           command line, which COMSH interprets like any other command;
  139.           and, after executing  the  command,  COMSH  returns  to  the
  140.           communications mode.  Thus, you are  able  to  program  (the
  141.           keys are [re]definable, see "SET") several command sequences
  142.           into the function keys.
  143.  
  144.           Two special function keys are  available  in  communications
  145.           mode: F10 and shift-F1.  F10 presents  you  with  the  COMSH
  146.           command prompt (%), and allows you to type one command  line
  147.           in.  That command line is executed, and you are  immediately
  148.           returned to command  mode.   Shift-F1  causes  you  to  exit
  149.           communications mode back to command mode.
  150.  
  151.           [screens]
  152.  
  153.           If your computer has the appropriate hardware (i.e., a Color
  154.           Graphics adapter), you can utilize your  four  text  screens
  155.           under COMSH (See STTY).
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                      - 3 -
  196.  
  197.  
  198.  
  199.  
  200.  
  201.           Program Startup
  202.  
  203.  
  204.  
  205.                                 Program Startup
  206.  
  207.  
  208.  
  209.           [Invoking Comsh]
  210.  
  211.           Comsh is invoked just like any other PC/MS-DOS program:  you
  212.           simply type "comsh" at the DOS prompt (which is usually "A>"
  213.           or similar).  For example:
  214.                   A> comsh
  215.  
  216.           When  Comsh  first  starts  up,  it   looks   for   a   file
  217.           "profile.csh" in the default path on the default  drive  (if
  218.           you have MS/PC-DOS  2.xx)  or  just  on  the  default  drive
  219.           (MS/PC-DOS 1.xx).  If this file is found, it is executed  as
  220.           a script (see the section on scripts; a script is  merely  a
  221.           text file which has a sequence of Comsh  commands  that  are
  222.           executed).
  223.  
  224.           The purpose of having "profile.csh" is to allow you  to  set
  225.           default values for any of Comsh's  parameters  (e.g.,  touch
  226.           tone or pulse dialing), and to allow you to have Comsh  take
  227.           any initial  actions  you  want  (including,  if  you  like,
  228.           dialing into CompuServe and logging in!).
  229.  
  230.           There is another way to start comsh  up;  if,  after  typing
  231.           "comsh" you type the name of  a  script  (without  the  .csh
  232.           extension), then comsh will execute that script immediately.
  233.           For example, if you have a file called "login.csh" that  had
  234.           the  sequence  of  commands  necessary  to  log   you   into
  235.           CompuServe, you could type:
  236.                   A> comsh login
  237.           and Comsh would log you in immediately.
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                      - 4 -
  262.  
  263.  
  264.  
  265.  
  266.  
  267.                                                        Program Startup
  268.  
  269.           [What to do once you're in Comsh]
  270.  
  271.           Unless you have things established (via a profile.csh  file)
  272.           to switch you into communications mode, the first thing  you
  273.           see in Comsh (following the banner) is the prompt:
  274.                   %
  275.           This prompt (similar to MS/PC-DOS's A> prompt) lets you know
  276.           that Comsh is waiting for a command.  In  the  section  that
  277.           follows, commands and their usages are described in  detail.
  278.           Briefly, though, the most important command is "com":
  279.                   % com
  280.           which tells Comsh to connect you to the  modem.   Until  you
  281.           execute this command, you are talking to Comsh  --  not  the
  282.           modem and certainly not to CompuServe or anybody else.
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                      - 5 -
  328.  
  329.  
  330.  
  331.  
  332.  
  333.           Commands
  334.  
  335.  
  336.  
  337.                                     Commands
  338.  
  339.  
  340.           The true power of Comsh lies in its command repertoire.  All
  341.           though  the  numerous  commands  can  seem  confusing   (and
  342.           certainly not "user friendly"), the power available  to  the
  343.           user through these commands -- and through writing  programs
  344.           in the command language --  is  Comsh's  reason  for  being.
  345.           Once you've mastered the commands, you will be able  to  get
  346.           Comsh to  do  everything  including  fetch  the  (electronic
  347.           online version) Sunday paper for you!
  348.  
  349.           As mentioned above, the prompt used  by  the  communications
  350.           shell is a percent sign (%).   When  you  see  this  prompt,
  351.           Comsh is awaitng your command.  (Unless the computer you are
  352.           connected too also uses % as its prompt, in which case you'd
  353.           better know where you are...)
  354.  
  355.           While any command is executing (including scripts), a  break
  356.           key (control-scroll lock on the IBM PC, or control-break  on
  357.           the Tandy 2000) will  stop  everything  and  return  you  to
  358.           either command mode or communications mode  (depending  upon
  359.           which mode you were in when you executed the command).
  360.  
  361.                Command Syntax
  362.                --------------
  363.  
  364.           Every command issued to Comsh consists of the  command  name
  365.           followed by a  list  of  arguments  to  the  command.   Each
  366.           argument is seperated from the others by  a  space.   Should
  367.           you wish to embed  a  space  within  an  argument,  you  may
  368.           enclose the entire argument in quotes (").  For example,  if
  369.           you issue the following echo command:
  370.                echo hello there
  371.           you have supplied two arguments ("hello" and "there") to the
  372.           echo command.  If, however, you type:
  373.                echo "hello there"
  374.           you have supplied one argument ("hello there") to  the  echo
  375.           command.  It is important to remember that  the  quotes  are
  376.           stripped off before being passed to a command; thus, both of
  377.           the above commands will result in
  378.                hello there
  379.           being printed on the terminal.  However,:
  380.                   echo Hello    There
  381.           and
  382.                   echo "Hello    There"
  383.           do not return the same result;  the  excess  spaces  between
  384.           Hello and There are stripped in the first case and preserved
  385.           in the second case.
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                      - 6 -
  394.  
  395.  
  396.  
  397.  
  398.  
  399.                                                               Commands
  400.  
  401.  
  402.           The reasons for this difference may seem hazy at first;  for
  403.           now, it is best to just note that Comsh  eats  extra  spaces
  404.           unless the spaces are preserved by quotes.
  405.  
  406.           You may type in several commands on one line;  to  do  this,
  407.           you must  seperate  each  command  with  a  semicolon.   For
  408.           example, the following
  409.                echo Directory of device A: ; ls a
  410.           will cause the  message  "Directory  of  device  A:"  to  be
  411.           printed on the screen followed by the directory of disk A:.
  412.  
  413.           You may embed special (e.g.,  control)  characters  in  your
  414.           arguments;  the notation
  415.                \c
  416.           will be translated to control-C, while
  417.                \m
  418.           will be translated to control-M  (a  carriage  return).   In
  419.           addition,
  420.                \$
  421.           is translated to simply $, while
  422.                \"
  423.           becomes " and
  424.                \\
  425.           becomes \.
  426.  
  427.                Variables
  428.                ---------
  429.  
  430.           The communications shell keeps track  of  several  variables
  431.           during its life.  These  variables  can  be  used  for  many
  432.           purposes, including function  key  assignment  and  argument
  433.           passing to scripts (see SET).  When an argument to a command
  434.           starts with a dolar sign ($), the actual argument passed  to
  435.           the command is  not  $<whatever>,  but  the  value  of  that
  436.           variable.  For example, let's say we've defined the variable
  437.           myname to be "charles".  Then, if we say
  438.                echo $myname
  439.           the communications shell will respond with:
  440.                charles
  441.           and *not*:
  442.                $myname
  443.  
  444.           Several variables are "magic".  Specifically, the variable $
  445.           (which is referenced by "$$") is used by scripts to indicate
  446.           how many arguments have been passed to them.  The  variables
  447.           0 through 9 (i.e., $0 through $9), represent  the  arguments
  448.           to the script.   Variable  0  always  is  the  name  of  the
  449.           currently  executing  script.   These  variables  are  local
  450.           during the execution of scripts, and  are  preserved  during
  451.           nesting of script execution (see section  on  Scripts).   An
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.                                      - 7 -
  460.  
  461.  
  462.  
  463.  
  464.  
  465.           Commands
  466.  
  467.           amusing example of a script that uses its arguments is:
  468.                rm $0
  469.           which is  a  one  line  script  that  automatically  deletes
  470.           itself.
  471.  
  472.           The variable $TIME returns  the  current  time  of  day  (in
  473.           HH:MM:SS format),  while  the  variable  $DATE  returns  the
  474.           current date (in the format MM-DD-YY).  The  variable  $FREE
  475.           returns the number of free bytes left in the capture buffer,
  476.           while the variable $SIZE returns the number of bytes in  the
  477.           capture buffer.  The variable $RESULT is set to zero when  a
  478.           command completes successfully,  while  it  is  non-zero  if
  479.           there was an error in the command's execution.
  480.  
  481.           *** WARNING ***
  482.  
  483.           In COMSH 1.7, variable names should not  be  longer  than  7
  484.           characters.  Longer names  will  be  accepted,  and  can  be
  485.           referenced, but they produce undesirable side-effects (viz.,
  486.           garbage in the variable symbol table).
  487.  
  488.           Following is an aphabetical list of all  commands  currently
  489.           supported by the communications shell.
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.                                      - 8 -
  526.  
  527.  
  528.  
  529.  
  530.  
  531.                                           Commands: add, sub, mul, div
  532.  
  533.  
  534.  
  535.                                add, sub, mul, div
  536.  
  537.           SYNTAX:
  538.                   add <varname> <value>
  539.                   sub <varname> <value>
  540.                   mul <varname> <value>
  541.                   div <varname> <value>
  542.  
  543.           DESCRIPTION:
  544.  
  545.           These four commands provide a means  for  Comsh  scripts  to
  546.           manipulate numeric and time data.  Each command performs the
  547.           operation specified between the  contents  of  the  variable
  548.           <varname>  and  <value>,  and  stores  the  result  back  in
  549.           <varname>.
  550.  
  551.           For example, let's say the variable "count" has "1"  in  it.
  552.           Then,
  553.                   add count 1
  554.           would result in $count returning 2 afterwards.  Likewise, if
  555.           "count" has "2" in it,
  556.                   mul count 5
  557.           would result in $count returning 10 afterwards.
  558.  
  559.           A  special  feature  of  these  operators  is  that  if  the
  560.           <varnmame> is  in  the  format  <days>:<hours>:<mins>:<secs>
  561.           (where days and hours  are  optional),  the  result  of  the
  562.           operation will be  stored  in  that  format.   For  example,
  563.           suppose the variable "now" has the value "10:42:30".  If  we
  564.           say:
  565.                   add now 65
  566.           "now" will  then  contain  "10:43:35".   Or,  if  "now"  has
  567.           "14:32", saying:
  568.                   add now 1:03
  569.           will result in "now" containing "15:35".
  570.  
  571.           Conversely, if <varname> is in a simple  numeric  form,  but
  572.           <value> is in DD:HH:MM:SS  form,  <value>  is  converted  to
  573.           seconds first and then  added  (or  subtracted,  multiplied,
  574.           divided) into <variablename>.  For example, let's  say  that
  575.           "grue" has the value "55".  Saying:
  576.                   add grue 1:00
  577.           will result in "grue" having "115".
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.                                      - 9 -
  592.  
  593.  
  594.  
  595.  
  596.  
  597.           Commands: add, sub, mul, div
  598.  
  599.           The value of all this is perhaps  best  illuminated  in  the
  600.           following short script.
  601.  
  602.           :       sleepuntil <time>
  603.           : This  script  sleeps  until  the  specified  time,  unlike
  604.           Comsh's
  605.           : sleep, which sleeps for a specified number of seconds.
  606.           set stime $1
  607.           : this next line should return the amount of time to sleep.
  608.           sub stime $TIME
  609.           : if it is negative, then we're being asked to sleep until
  610.           : tomorrow sometime
  611.           if !greater 0 $stime ok
  612.           : it is negative ... add one day's worth of time in to make
  613.           : it postive again
  614.           add stime 1:0:0:0
  615.           : ok
  616.           set foo 0
  617.           : convert from d:h:m:s format to just seconds
  618.           add foo $stime
  619.           : and sleep until then!
  620.           sleep $foo
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.                                      - 10 -
  658.  
  659.  
  660.  
  661.  
  662.  
  663.                                                       Commands: Append
  664.  
  665.  
  666.  
  667.                                      Append
  668.  
  669.           SYNTAX:
  670.                ap <file1> <file2>
  671.  
  672.           DESCRIPTION:
  673.  
  674.           The "ap" command appends the contents of file1 to the end of
  675.           file2.  This is useful for appending "session"  logs  (files
  676.           which have been captured just this last session) to the  end
  677.           of more permanent log files.
  678.  
  679.           The destination file (<file2>) is actually appended to; that
  680.           is, the append process does not create a third, intermediate
  681.           file.  This can cause some problems if the disk  decides  to
  682.           become full (or croak) during the append process, as <file2>
  683.           will have part of <file1> appended to it, but not all of it.
  684.           Caveat Appendix.
  685.  
  686.           SEE ALSO:
  687.                   apl, cp, mv
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.                                      - 11 -
  724.  
  725.  
  726.  
  727.  
  728.  
  729.           Commands: apl
  730.  
  731.  
  732.  
  733.                                       apl
  734.  
  735.           SYNTAX:
  736.                   apl [-n] <file> <text>
  737.  
  738.           DESCRIPTION:
  739.  
  740.           The append line command is used to append one line  of  text
  741.           to a specified file.  The file is created  if  it  does  not
  742.           exist.  For example,
  743.                   apl foo.bar "This is a test!"
  744.           will append the line "This is a test" to the end of the file
  745.           "foo.bar" (Please don't groan at the metafilenames.)
  746.  
  747.           The "-n" option causes the command to not place  a  crlf  at
  748.           the end of the line being writen; this is useful if you want
  749.           to build up the line in several apls (but this  approach  is
  750.           slow).  For example, "Hello There" can be writen out to  the
  751.           end of foo.bar by executing:
  752.                   apl -n foo.bar "hello"          <-- Note -n
  753.                   apl foo.bar " there"            <-- Note space!
  754.                                                   <-- Note no -n
  755.  
  756.           SEE ALSO:
  757.                   ap, read, set, who.csh
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.                                      - 12 -
  790.  
  791.  
  792.  
  793.  
  794.  
  795.                                                    Commands: captodisk
  796.  
  797.  
  798.                                    captodisk
  799.  
  800.  
  801.  
  802.           SYNTAX:
  803.                   captodisk <filename>
  804.                   captodisk
  805.  
  806.           DESCRIPTION:
  807.  
  808.           The captodisk command is used to start and stop  the  direct
  809.           capturing of input data to a disk file.  If you specify:
  810.                   captodisk <filename>
  811.           all subsequent incoming data  is  writen  out  to  the  file
  812.           specified (assuming that it could be opened).  If  you  just
  813.           specify:
  814.                   captodisk
  815.           any previous capturing to disk is stopped, the file  closed,
  816.           and no capturing to disk will take  place  (until  the  next
  817.           captodisk <filename> command).
  818.  
  819.           One interesting application of this is to say:
  820.                   captodisk prn:
  821.           which will cause a transcript of all  data  received  to  be
  822.           printed.  Note that this make cause delays on  your  screen,
  823.           as the screen I/O routines wait  to  get  their  data  until
  824.           after captodisk has finished  writing  its  data.   A  pause
  825.           while the printer  buffer  empties  will  cause  the  screen
  826.           output to pause too.  But, so long  as  you  have  interrupt
  827.           handling (e.g., a Tandy 2000 or IBM PC using  COMBIOS),  you
  828.           won't lose any data.
  829.  
  830.           SEE ALSO:
  831.                   close, open, write, reset
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.                                      - 13 -
  856.  
  857.  
  858.  
  859.  
  860.  
  861.           Commands: cat
  862.  
  863.  
  864.                                       cat
  865.  
  866.  
  867.  
  868.           SYNTAX:
  869.                cat <file> [<file> ...]
  870.  
  871.           DESCRIPTION:
  872.  
  873.           The "cat" command is used to type the contents of a file out
  874.           on the terminal's screen.  If you want to stop  the  display
  875.           of a cat prematurely, the break key will stop cat ...  along
  876.           with any executing scripts, etc.  As a general rule, if  you
  877.           want to browse  through  a  file,  the  more  command  works
  878.           better.
  879.  
  880.           SEE ALSO:
  881.                   more
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.                                      - 14 -
  922.  
  923.  
  924.  
  925.  
  926.  
  927.                                                           Commands: cb
  928.  
  929.  
  930.                                        cb
  931.  
  932.  
  933.           SYNTAX:
  934.                   cb [-s | -s0 | -s1 | -s2 | -s3]
  935.  
  936.           DESCRIPTION:
  937.  
  938.           The "cb" command is used to place the  communications  shell
  939.           into  "cb"  mode.   This  mode  is  designed  to  work  with
  940.           CompuServe's CB, CO, and EIS Conference Room.   The  purpose
  941.           of this command is  to  keep  your  screen  uncluttered  and
  942.           organized  while  you  are  talking.   Your  input  proceeds
  943.           uninterrupted on the bottom  line  while  incoming  messages
  944.           arive just above your text.   When  you  type  return,  your
  945.           message is merged in with the incoming messages in  a  clean
  946.           manner.
  947.  
  948.           If a line is received from CIS/EIS that is  longer  than  80
  949.           characters long, the CB mode will perform word  wrapping  to
  950.           the next line -- and indent the next line by a few spaces to
  951.           show that  the  line  is  a  continuation  of  the  previous
  952.           message.
  953.  
  954.           OPERATION:
  955.  
  956.           In order for cb mode to be particularly useful, you must  be
  957.           running  half  duplex  (i.e.,  stty  -echo).    Since   most
  958.           terminals run in full duplex, with the host  system  echoing
  959.           each character as it is typed, it will probably take  a  bit
  960.           of effort to get the system to switch to  half  duplex.   On
  961.           CIS, the easiest way is to issue the "HALFD"  command  while
  962.           in the personal file area (the "OK"  prompt).   Once  you've
  963.           done that, you'll also want  to  tell  Comsh  that  you  are
  964.           running in half duplex mode; that can be  performed  by  the
  965.           command:
  966.                   stty -echo
  967.           (note that you'll probably have to hit f10 first  to  get  a
  968.           Comsh prompt, and then give the "stty -echo" command).
  969.  
  970.           Two function key assignments are  hardwired  into  cb  mode.
  971.           Alt-f1 will exit cb mode, and f10 will allow  you  to  issue
  972.           one Comsh command.
  973.  
  974.           OPTIONS:
  975.  
  976.           The various -s options  (which  are,  of  course,  optional)
  977.           determine which of the 4 screens will be used  by  cb.   The
  978.           "-s" optiion uses the default communications screen  (screen
  979.           1),  while  -s0  through  -s3  pick  screens  0  through  3,
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.                                      - 15 -
  988.  
  989.  
  990.  
  991.  
  992.  
  993.           Commands: cb
  994.  
  995.           respectively.  If no option is supplied, the current  screen
  996.           is used.
  997.  
  998.           BUGS:
  999.  
  1000.           Switching screens mid CB-Session is rather awkward.
  1001.  
  1002.           CB mode doesn't work on 24 line screens (set by "stty 24").
  1003.  
  1004.           Since CB mode waits for a  <cr>  to  arrive  from  the  host
  1005.           before displaying any part of a  line  from  CIS,  the  /han
  1006.           command doesn't work too well.  CIS sends  out  the  "Handle
  1007.           name? " prompt without a <cr>, and  so  CB  mode  just  sits
  1008.           there and waits for the <cr>.  There are three solutions  to
  1009.           this problem.  (1) Drop back to "com" mode (either by alt-f1
  1010.           or via f10/com), change your handle, and return to CB  mode.
  1011.           (2) After you type /han,  go  ahead  and  type  your  handle
  1012.           without the prompt.  When you type return, the  prompt  will
  1013.           scroll on by.  Or (3) write a script to change  your  handle
  1014.           and don't worry about it...
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.                                      - 16 -
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.                                                           Commands: cd
  1060.  
  1061.  
  1062.                                        cd
  1063.  
  1064.  
  1065.  
  1066.           SYNTAX:
  1067.                   cd <path>
  1068.  
  1069.           DESCRIPTION:
  1070.  
  1071.           The cd command is used under DOS 2.x to change your  current
  1072.           directory.   Because  Comsh  uses   DOS   1.x   file   calls
  1073.           exclusively (except for cd & pwd), it  is  necessary  to  be
  1074.           "in" the directory of any files you wish to read /  write  /
  1075.           create, etc.  The cd command  is,  then,  a  limited  DOS  2
  1076.           support; if you have DOS 2, it provides you with  access  to
  1077.           all of your directories; if  you  have  DOS  1,  you  aren't
  1078.           prevented from doing file I/O.
  1079.  
  1080.           Please note that this command is not the same as the  DOS  2
  1081.           cd; it does not print the path when there are no arguments.
  1082.  
  1083.           EXAMPLE:
  1084.                   cd A:\Comsh\FILES
  1085.  
  1086.           SEE ALSO:
  1087.                   pwd
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.                                      - 17 -
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.           Commands: clear
  1126.  
  1127.  
  1128.                                      clear
  1129.  
  1130.  
  1131.  
  1132.           SYNTAX:
  1133.                   clear
  1134.  
  1135.           DESCRIPTION:
  1136.  
  1137.           The clear command clears the current screen.  If you wish to
  1138.           clear a different screen, you will have to switch over to it
  1139.           first.
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.                                      - 18 -
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.                                                        Commands: close
  1192.  
  1193.  
  1194.                                      close
  1195.  
  1196.  
  1197.  
  1198.           SYNTAX:
  1199.                   close
  1200.  
  1201.           DESCRIPTION:
  1202.  
  1203.           The close command causes the capture buffer  to  be  closed.
  1204.           After that, all incoming  information  is  not  saved  until
  1205.           another open command is performed.
  1206.  
  1207.           SEE ALSO:
  1208.                   open, write, cap
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.                                      - 19 -
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.           Commands: com
  1258.  
  1259.  
  1260.                                       com
  1261.  
  1262.  
  1263.  
  1264.           SYNTAX:
  1265.                   com [-s<n>]
  1266.  
  1267.           DESCRIPTION:
  1268.  
  1269.           The com command switches the user into communications  mode,
  1270.           i.e., anything the user types is sent  out  the  rs232/modem
  1271.           port and anything received is sent to the screen.  While  in
  1272.           communications  mode,  the  user  has  a  few  function  key
  1273.           commands available to him; see the section on communications
  1274.           mode for further details. The -s option is used to determine
  1275.           which  screen  (of  the  4)  will  be  used  initially   for
  1276.           communications.  If no  screen  is  specified,  the  current
  1277.           screen will be used.
  1278.  
  1279.           The initial definitions for function keys are:
  1280.  
  1281.                   F1      -- "more comsh.hlp"
  1282.                   F2      -- "clear"
  1283.                   F9      -- sends a control-o followed by a return
  1284.                   F10     -- gives you a chance to execute one command
  1285.                   Alt-F1  -- Returns to previous mode.
  1286.  
  1287.  
  1288.           SEE ALSO:
  1289.                   switch
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.                                      - 20 -
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.                                                           Commands: cp
  1324.  
  1325.  
  1326.                                        cp
  1327.  
  1328.  
  1329.           SYNTAX:
  1330.                   cp <source> <dest>
  1331.  
  1332.           DESCRIPTION:
  1333.  
  1334.           The "cp" command is used to copy one file to  another.   For
  1335.           example, to copy "Comsh.exe" to "Comsh.bak" on drive B:, you
  1336.           would type:
  1337.                   cp Comsh.exe b:Comsh.bak
  1338.  
  1339.           As an interesting note, it seems that the DOS  copy  command
  1340.           has some sort of protection  scheme  built  into  it;  thus,
  1341.           certain files cannot be copied with it. While I  don't  want
  1342.           to promote Comsh as a copy  protect  defeat  mechanism,  the
  1343.           Comsh cp command has no such limitations...
  1344.  
  1345.           SEE ALSO:
  1346.                   ap
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.                                      - 21 -
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.           Commands: dial
  1390.  
  1391.  
  1392.                                       dial
  1393.  
  1394.  
  1395.           SYNTAX:
  1396.                   dial
  1397.                   dial <name>
  1398.                   dial <name> <service>
  1399.  
  1400.           DESCRIPTION:
  1401.  
  1402.           The "dial" command is used to auto-dial a hayes smart modem;
  1403.           it knows how to dial local  numbers  and  can  interface  to
  1404.           various long distance services (like MCI or SPRINT  or  even
  1405.           AT&T!).  The command has three forms of interest:
  1406.  
  1407.                   (1)     dial
  1408.                   (2)     dial <name>
  1409.                   (3)     dial <name> <service>
  1410.  
  1411.           (1) Merely instructs dial to list all of the  various  phone
  1412.           numbers you can call.
  1413.  
  1414.           (2) tells Comsh to dial the computer called <name> which  is
  1415.           in your local dialing range.
  1416.  
  1417.           (3) tells Comsh to dial  the  computer  called  <name>  long
  1418.           distance  using  the  long  distance  phone  company  called
  1419.           <service>.
  1420.  
  1421.           At the current moment, the dial command knows  only  how  to
  1422.           dial Hayes Smartmodem (and compatibles).  Other modem  types
  1423.           can will be added if/when the author of Comsh is told how to
  1424.           work them....
  1425.  
  1426.           All dial does is to output the correct command to the  modem
  1427.           to dial the phone; it does not check to see if the call  was
  1428.           completed or not.  Checking the success of  a  call  can  be
  1429.           done by setting up the appropriate patterns and waiting  for
  1430.           one of them to occur (See the next section on scripts).
  1431.  
  1432.           The dial command defaults to touch tone dialing;  see  "stty
  1433.           -tt" for information on how to set the dial command  up  for
  1434.           pulse dialing.
  1435.  
  1436.           FILE FORMATS:
  1437.  
  1438.           In order to actually know where to call,  the  dial  command
  1439.           needs to have at least one file on the default drive (in the
  1440.           default directory, for you DOS 2 users).  This file must  be
  1441.           called "PHONE.NUM".  Phone.num is a text file, each line  of
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.                                      - 22 -
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.                                                         Commands: dial
  1456.  
  1457.           which contains one entry in the phone numbers database.  The
  1458.           format of each line is:
  1459.  
  1460.           <name>:<phone-number>:<baud-rates>:<comments>
  1461.  
  1462.           For example, here's a short example:
  1463.  
  1464.                cis0:7584114:300:CompuServe 300 baud only
  1465.                cis1:7582090:1200,300:CompuServe 1200/300
  1466.                pcbbsnyc:541-5975:1200,300:PC BBS in NYC
  1467.                mci:245-0355:1200,300:MCI Mail New York Node
  1468.                proshop:617-461-0174::Programmer's shop (7pm - 7am)
  1469.                pcbbsli:516-944-6712:300,1200:RBBS Long Island
  1470.  
  1471.  
  1472.           Notice that the long distance entries do not have a  leading
  1473.           "1" (for long distance access).  This  is  because  not  all
  1474.           long distance dialing services want that "1" before the area
  1475.           code.  (MCI, for example, gags  on  a  "1"  before  an  area
  1476.           code).  Of course, AT&T  or  your  local  operating  company
  1477.           *will* want that leading "1" if you're going to dial via the
  1478.           conventional, costly route.  In  order  to  give  each  long
  1479.           distance service what they need, there is a  "service"  file
  1480.           which has two entries  in  it  (each  entry  on  a  line  to
  1481.           itself).  The first entry contains the codes to  prefix  the
  1482.           phone number with; the second entry contains  the  codes  to
  1483.           postfix the phone number with.  Thus, for  example,  an  ATT
  1484.           service file would look like:
  1485.  
  1486.                1-
  1487.  
  1488.  
  1489.           The second line of the service file  is  blank  because  the
  1490.           phone number is the last thing that will be dialed (and thus
  1491.           there's no postfix).  A sample MCI service file  would  look
  1492.           something like:
  1493.  
  1494.                0000000,,,,11111-
  1495.                ,
  1496.  
  1497.           Where "0000000" would be replaced with the local MCI  access
  1498.           number  and  "11111"  would  be  replaced  with   your   MCI
  1499.           "password".  The commas between the local MCI access  number
  1500.           and the  password  tell  the  Hayes  modem  to  pause;  four
  1501.           provides a reasonable delay to allow  MCI  to  answer.   The
  1502.           second entry (just ",") is to provide a slight  extra  delay
  1503.           since MCI is sometimes slow in making a connection.
  1504.  
  1505.           In these examples, the service files would be called  "ATT."
  1506.           and "MCI.".  Thus, you could say:
  1507.                   dial pcbbsli mci
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.                                      - 23 -
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.           Commands: dial
  1522.  
  1523.           to reach the pc bbs in long island using MCI.
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.                                      - 24 -
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.                                                         Commands: echo
  1588.  
  1589.  
  1590.                                       echo
  1591.  
  1592.  
  1593.           SYNTAX:
  1594.                   echo [-n] <text>
  1595.  
  1596.           DESCRIPTION:
  1597.  
  1598.           The echo command merely echoes any  text  after  it  to  the
  1599.           screen.  This is useful in printing prompts,  message,  etc.
  1600.           to the screen during the execution of a  script.   The  "-n"
  1601.           operation cause the echo command to inhibit writing a <crlf>
  1602.           after the text; this is useful when you want  to  allow  the
  1603.           user to enter a response on the same line as a prompt.
  1604.  
  1605.           EXAMPLES:
  1606.  
  1607.                   echo This is a test             will print...
  1608.                   This is a test<crlf>
  1609.  
  1610.                   echo -n This is a second test   will print...
  1611.                   This is a second text<cursor>
  1612.  
  1613.           NOTES:
  1614.  
  1615.           Echo takes each of its arguments, and outputs them seperated
  1616.           by one space.  As pointed out earlier in this  manual,  echo
  1617.           hello   there and echo "hello    there" do  not  return  the
  1618.           same results.  If you want  to  echo  information  in  fancy
  1619.           layouts, you should quote your arguments to be safe.
  1620.  
  1621.           SEE ALSO:
  1622.                   read
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.                                      - 25 -
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.           Commands: exit
  1654.  
  1655.  
  1656.                                       exit
  1657.  
  1658.  
  1659.           SYNTAX:
  1660.                   exit
  1661.  
  1662.           DESCRIPTION:
  1663.  
  1664.           Exit causes you to leave Comsh and return to the DOS command
  1665.           level.
  1666.  
  1667.           BUGS:
  1668.  
  1669.           If you've just downloaded 30k into your capture buffer,  and
  1670.           type "exit", Comsh will gleefully eat your buffer and  leave
  1671.           you with no means  of  recovering  it.   If  you  find  this
  1672.           happens to you too  often,  create  a  short  script  called
  1673.           "quit.csh" that looks like this:
  1674.  
  1675.                   : quit.csh
  1676.                   if !same $SIZE 0 nowayjose
  1677.                   exit
  1678.                   : nowayjose
  1679.                   echo "Please do something with the capture buffer."
  1680.  
  1681.           Then use "quit" instead of "exit" as your  normal  means  of
  1682.           leaving Comsh.
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.                                      - 26 -
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.                                         Commands: fclose, fgets, fopen
  1720.  
  1721.  
  1722.                               fclose, fgets, fopen
  1723.  
  1724.  
  1725.           SYNTAX:
  1726.                   fclose
  1727.                   fgets <varname>
  1728.                   fopen <filename>
  1729.  
  1730.           DESCRIPTION:
  1731.  
  1732.           There are often times when it is necessary for Comsh to deal
  1733.           with text files a line at a time rather than  all  at  once.
  1734.           Thus, for example, the "apl" command exists -- it allows you
  1735.           to write one line to the  end  of  a  file.   Likewise,  the
  1736.           fclose, fgets, and fopen command exist to allow you to  read
  1737.           a file into Comsh variables one line at a time.
  1738.  
  1739.           The primary motavation behind these commands was to allow  a
  1740.           simple script (given below) to be writen that would  send  a
  1741.           message to a SIG one line at a time,  pausing  for  the  ":"
  1742.           prompt before sending each line.
  1743.  
  1744.           The first  command  that  should  be  used  is  the  "fopen"
  1745.           command.  This command prepares Comsh to read lines in  from
  1746.           the named file.  For example, if you say:
  1747.                   fopen mymsg.txt
  1748.           Comsh will try to open the file "mymsg.txt".   If  the  file
  1749.           exists, and  can  be  opened,  the  variable  "RESULT"  will
  1750.           contain 0 (e.g., the command:
  1751.                   if same $RESULT 0 foo
  1752.           will branch to the label  "foo").   If  the  file  does  not
  1753.           exist, or cannot be opened for any  other  reason,  "RESULT"
  1754.           will be non-zero.
  1755.  
  1756.           One a file has been fopened, lines can be read from the file
  1757.           one at a time via the "fgets"  command.   Asumming  that  we
  1758.           just did the fopen mymsg.txt command -- and that $RESULT  is
  1759.           zero -- the command:
  1760.                   fgets lvar
  1761.           will read the first line from the file  mymsg.txt  into  the
  1762.           variable "lvar".  Subsequent  fgets  will  return  the  next
  1763.           lines in mymsg.txt.
  1764.  
  1765.           In order for you to know when you've reached the end of  the
  1766.           file, fgets, like fopen, sets  the  variable  "RESULT".   If
  1767.           RESULT is zero immediately after fgets, then  everythins  is
  1768.           ok.  If RESULT is  non-zero,  then  end  of  file  has  been
  1769.           reached, and the contents of the variable fgets'ed into  are
  1770.           garbage.
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.                                      - 27 -
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.           Commands: fclose, fgets, fopen
  1786.  
  1787.           Once you reach the end of the file, you  should  tell  Comsh
  1788.           that you are through with the file.  The command:
  1789.                   fclose
  1790.           will have Comsh close the file; that  allows  you  to  fopen
  1791.           another file later.
  1792.  
  1793.           The following script implements a send to sig  command  that
  1794.           will send a text file to a sig one line at a  time,  pausing
  1795.           before each line for the sig editor's prompt:
  1796.  
  1797.                   : usage: sendsig <filename>
  1798.                   fopen $1
  1799.                   if !same $RESULT 0 nofile
  1800.                   pattern reset
  1801.                   pattern 0 ":\i"
  1802.                   : loop
  1803.                   fgets line
  1804.                   if !same $RESULT 0 done
  1805.                   send $line \m
  1806.                   wait 10
  1807.                   if match 0 loop
  1808.                   echo Time out!
  1809.                   goto done
  1810.                   : nofile
  1811.                   echo No file $1
  1812.                   goto end
  1813.                   : done
  1814.                   fclose
  1815.                   : end
  1816.                   echo "End of Sendsig [28-Jun-84]"
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.                                      - 28 -
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.                                                         Commands: goto
  1852.  
  1853.  
  1854.                                       goto
  1855.  
  1856.  
  1857.           SYNTAX:
  1858.                   goto <label>
  1859.  
  1860.           DESCRIPTION:
  1861.  
  1862.           Goto is used within a script file to unconditionally goto  a
  1863.           given label.  If the label is not found, a nasty message  is
  1864.           printed out and the script is terminated.
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.                                      - 29 -
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.           Commands: grep
  1918.  
  1919.  
  1920.                                       grep
  1921.  
  1922.  
  1923.           SYNTAX:
  1924.                   grep <pat> <file>
  1925.  
  1926.           DESCRIPTION:
  1927.  
  1928.           Grep is a utility that prints out all lines in  file  <file>
  1929.           that contain the pattern <pat>.  At the moment, the  pattern
  1930.           is simply a sequence of characters that must occur in a line
  1931.           from <file> in order for that line to be printed.
  1932.  
  1933.           EXAMPLES:
  1934.  
  1935.           If the following three lines are in the file night.day:
  1936.  
  1937.                this is a test
  1938.                And so is this
  1939.                Line 3 is another test
  1940.  
  1941.           Then:
  1942.  
  1943.           grep "this" night.day
  1944.  
  1945.           would produce:
  1946.  
  1947.           this is a test
  1948.           And so is this
  1949.  
  1950.           While:
  1951.  
  1952.           grep "test" night.day
  1953.  
  1954.           would produce:
  1955.  
  1956.           this is a test
  1957.           Line 3 is another test
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.                                      - 30 -
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.                                                           Commands: if
  1984.  
  1985.  
  1986.                                        if
  1987.  
  1988.  
  1989.           SYNTAX:
  1990.                   if [!]match <pattern> <label>
  1991.                   if [!]same <arg1> <arg2> <label>
  1992.                   if [!]fexist <file> <label>
  1993.  
  1994.           DESCRIPTION:
  1995.  
  1996.           The "if" command is used to make conditional branches within
  1997.           a script.  The if command provides six conditions  that  can
  1998.           be tested,  and  the  brach  to  <label>  is  taken  if  the
  1999.           condition is true.  The specific conditions are:
  2000.  
  2001.                   match <pattern>
  2002.           This condition tests to see if the "wait" command terminated
  2003.           because pattern number <pattern>  was  found.   A  match  of
  2004.           pattern -1 indicates that a time out occured.
  2005.  
  2006.                   !match <pattern>
  2007.           Like the "match" condition, except the branch  is  taken  if
  2008.           pattern <pattern> *wasn't* the reason for wait to terminate.
  2009.  
  2010.                   same <arg1> <arg2>
  2011.           This condition tests to see if <arg1> is the same as <arg2>.
  2012.           Normally, one or both of the  arguments  is  a  variable;  a
  2013.           common test is to compare a variable to a constant.  If  the
  2014.           two arguments match, the branch is taken.
  2015.  
  2016.                   !same <arg1> <arg2>
  2017.           Like "same", excpet the branch is taken if the two arguments
  2018.           don't match.
  2019.  
  2020.                   fexist <filename>
  2021.           This condition is TRUE (i.e., the branch is  taken)  if  the
  2022.           file <filename> can be opened  for  read  access  (which  is
  2023.           taken to mean that the file does  exist).   Thus,  before  a
  2024.           script opens a file, it can test for  the  file's  existance
  2025.           and branch to an error routine if the file does not exist.
  2026.  
  2027.                   !fexist <filename>
  2028.           Like "fexist", but the branch is taken if the file does  not
  2029.           exist.
  2030.  
  2031.           EXAMPLES:
  2032.  
  2033.           if same $1 -add do-add
  2034.           if !fexist mydata.txt no-file
  2035.           if match 0 got-match
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.                                      - 31 -
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.           Commands: ls
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.                                      - 32 -
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.                                                           Commands: ls
  2116.  
  2117.  
  2118.                                        ls
  2119.  
  2120.  
  2121.           SYNTAX:
  2122.                   ls [<drive>]
  2123.  
  2124.           DESCRIPTION:
  2125.  
  2126.           The "ls" command lists the files on a given  drive  (or  the
  2127.           default drive, if no drive is specified).   The  ls  command
  2128.           will only list the files in the current directory (DOS 2.0),
  2129.           and does not display entries for any directories or  special
  2130.           files.
  2131.  
  2132.           EXAMPLES:
  2133.  
  2134.           ls                      <-- Lists directory on default drive
  2135.           ls b                    <-- List directory on drive b
  2136.  
  2137.           SEE ALSO:
  2138.                   cd, pwd
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.                                      - 33 -
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.           Commands: more
  2182.  
  2183.  
  2184.                                       more
  2185.  
  2186.  
  2187.           SYNTAX:
  2188.                   more <file>
  2189.  
  2190.           DESCRIPTION:
  2191.  
  2192.           The more command prints out the contents of a file like cat,
  2193.           but pauses every screenful to allow you to read  it.   Every
  2194.           22 lines, the "--MORE--" prompt is displayed; if you type  a
  2195.           return, you get one more line; if you type a space, you  get
  2196.           a  screenful.   If  you  type  control-c,  you'll  stop  the
  2197.           display.
  2198.  
  2199.           BUGS:
  2200.  
  2201.           The use of control-c is history; the  break  key  should  be
  2202.           substituted for consistency.
  2203.  
  2204.           SEE ALSO:
  2205.  
  2206.                   cat
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.                                      - 34 -
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.                                                           Commands: mv
  2248.  
  2249.  
  2250.                                        mv
  2251.  
  2252.  
  2253.           SYNTAX:
  2254.                   mv <file1> <file2>
  2255.  
  2256.           DESCRIPTION:
  2257.  
  2258.           The mv command renames <file1> to <file2>.
  2259.  
  2260.           BUGS:
  2261.  
  2262.           You  can't  specify  path  names,  and  so  moves  from  one
  2263.           directory to another don't work.
  2264.  
  2265.           SEE ALSO:
  2266.                   cp
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.                                      - 35 -
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.           Commands: open
  2314.  
  2315.  
  2316.                                       open
  2317.  
  2318.  
  2319.           SYNTAX:
  2320.                   open
  2321.  
  2322.           DESCRIPTION:
  2323.  
  2324.           Open opens the capture buffer; all characters received after
  2325.           the execution of the open  command  will  be  stashed  away.
  2326.           However, when Comsh is in command mode  --  or  executing  a
  2327.           command -- it ignores any data coming in  the  serial  port,
  2328.           and thus does not capture it.  The only exception to this is
  2329.           the "wait" command, which captures any data  that  comes  in
  2330.           while it is waiting.
  2331.  
  2332.           If the "wrapbuf" is  set  to  0  (most  likely  because  you
  2333.           haven't issued a wrapbuf command), Comsh  will  print  funny
  2334.           messages out as the buffer starts to  get  full.   When  the
  2335.           buffer is completely full,  an  automatic  "close"  will  be
  2336.           performed.  If, on the other hand, a wrapbuf is  in  effect,
  2337.           the buffer just overwrites  the  oldest  data  as  new  data
  2338.           arrives when the buffer is full.
  2339.  
  2340.           SEE ALSO:
  2341.                   close, reset, wrapbuf, write
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.                                      - 36 -
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.                                                      Commands: pattern
  2380.  
  2381.  
  2382.                                     pattern
  2383.  
  2384.  
  2385.           SYNTAX:
  2386.                   pattern [reset] [<number>] [<pattern>]
  2387.  
  2388.           DESCRIPTION:
  2389.  
  2390.           The pattern command is used to maintain the various patterns
  2391.           that will be matched by the "wait" command.  The first  form
  2392.           of the command is:
  2393.                   pattern reset
  2394.           which causes all of the  patterns  to  be  reset  (i.e.,  no
  2395.           patterns will ever match, and a  wait  command  will  either
  2396.           time out or hang forever).
  2397.  
  2398.           The second form of the pattern command is:
  2399.                   pattern reset <n>
  2400.           where <n> is in the range 0..9, and is  the  number  of  the
  2401.           individual pattern to reset.  Reseting a pattern  causes  it
  2402.           to no long be able to match anything.
  2403.  
  2404.           The third and final form of the command is:
  2405.                   pattern <n> <pat>
  2406.           which defines what pattern (<pat>) pattern <n> will match.
  2407.  
  2408.           EXAMPLES:
  2409.  
  2410.           pattern reset                   <-- Zero all patterns
  2411.           pattern reset 3                 <-- Prevent 3 from matching
  2412.           pattern 3 "This\m"              <-- Match 3 on This<cr>
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.                                      - 37 -
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.           Commands: pwd
  2446.  
  2447.  
  2448.                                       pwd
  2449.  
  2450.  
  2451.           SYNTAX:
  2452.                   pwd [<drive>]
  2453.  
  2454.           DESCRIPTION:
  2455.  
  2456.           The pwd command prints out the path of the current directory
  2457.           on the default drive (if no drive is specified)  or  on  the
  2458.           specified drive.  Note that this is a DOS 2 command only.
  2459.  
  2460.           EXAMPLES:
  2461.  
  2462.           pwd             <-- Current directory on default drive
  2463.           pwd b           <-- Current directory on drive b
  2464.  
  2465.           SEE ALSO:
  2466.                   cd
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.                                      - 38 -
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.                                                         Commands: read
  2512.  
  2513.  
  2514.                                       read
  2515.  
  2516.  
  2517.           SYNTAX:
  2518.                   read <var>
  2519.  
  2520.           DESCRIPTION:
  2521.  
  2522.           The read command allows the user to  type  in  one  line  of
  2523.           text, and then that entire line is stored in  the  specified
  2524.           variable.  No parsing of the text is done.
  2525.  
  2526.           A useful technique for  producing  nice  prompts  is  to  do
  2527.           something like:
  2528.                   echo -n "Please enter your name: "
  2529.                   read name
  2530.           The cursor will pause at the end of "name: " waiting for the
  2531.           user to type his name in  (as  opposed  to  waiting  at  the
  2532.           begining of the next line).
  2533.  
  2534.           EXAMPLE:
  2535.  
  2536.           read foo        <-- Afterwards, $foo will have the line
  2537.                               typed in.
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.                                      - 39 -
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.           Commands: reset
  2578.  
  2579.  
  2580.                                      reset
  2581.  
  2582.  
  2583.           SYNTAX:
  2584.                   reset
  2585.  
  2586.           DESCRIPTION:
  2587.  
  2588.           The "reset" command  zeroes  the  contents  of  the  capture
  2589.           buffer.  No questions are asked, nor is any warning given if
  2590.           the capture buffer had data in it.  If  a  "wrapbuf"  is  in
  2591.           effect, the reset command will turn that off.
  2592.  
  2593.           SEE ALSO:
  2594.                   open, close, wrapbuf, write
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.                                      - 40 -
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.                                                           Commands: rm
  2644.  
  2645.  
  2646.                                        rm
  2647.  
  2648.  
  2649.           SYNTAX:
  2650.                   rm <file> [<file> ...]
  2651.  
  2652.           DESCRIPTION:
  2653.  
  2654.           The rm command deletes the file(s) specified.  Note that the
  2655.           files  must  be  in  the  current  directory  of  the  drive
  2656.           specified.  "?" wildcards will work, but "*" wildcards  will
  2657.           not.
  2658.  
  2659.           EXAMPLES:
  2660.  
  2661.           rm comsh.???                    <-- Deletes COMSH.*
  2662.           rm this that the other          <-- Deletes four files
  2663.           rm ???????.???                  <-- You like living
  2664.                                               dangerously
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.                                      - 41 -
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.           Commands: see
  2710.  
  2711.  
  2712.                                       see
  2713.  
  2714.  
  2715.           SYNTAX:
  2716.                   see
  2717.  
  2718.           DESCRIPTION:
  2719.  
  2720.           The "see" command allows you to see the current contents  of
  2721.           the capture buffer without destroying them.  See, like more,
  2722.           prints out several lines, and then pauses, waiting  for  you
  2723.           to type either a space (22 more lines, please!) or a  return
  2724.           (one more line, if you would...).  A control-c stops  things
  2725.           where they stand.
  2726.  
  2727.           SEE ALSO:
  2728.                   more
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.                                      - 42 -
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.                                                         Commands: send
  2776.  
  2777.  
  2778.                                       send
  2779.  
  2780.  
  2781.           SYNTAX:
  2782.                   send <text>
  2783.  
  2784.           DESCRIPTION:
  2785.  
  2786.           The send command transmits the specified text to the  modem.
  2787.           One important use of this command is in conjunction with the
  2788.           fopen, fgets, and fclose commands.
  2789.  
  2790.           In some ways, send is  like  echo,  in  that  it  echos  its
  2791.           arguments (but to the modem).  However,  unlike  echo,  send
  2792.           does not supply a return automatically; you must  explicitly
  2793.           include a \m in your send to have a return transmitted.
  2794.  
  2795.           EXAMPLES:
  2796.  
  2797.           send \m                         <-- Sends a return
  2798.           send "hello\m"                  <-- Sends hello<cr>
  2799.  
  2800.           SEE ALSO:
  2801.                   fclose, fgets, fopen, read, echo
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.                                      - 43 -
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.           Commands: sendf
  2842.  
  2843.  
  2844.                                      sendf
  2845.  
  2846.  
  2847.           SYNTAX:
  2848.                   sendf [-l] <file>
  2849.  
  2850.           DESCRIPTION:
  2851.  
  2852.           The sendf command transmits a file out the modem  port.   If
  2853.           the  "-l"  option  is  specified,  newline   sequences   are
  2854.           transmitted  as  <crlf>,  otherwise  newline  sequences  are
  2855.           transmitted only as <cr>.
  2856.  
  2857.           If the "stty s" command has been given, the you will see the
  2858.           echo back from the remote computer during a "sendf".
  2859.  
  2860.           A break key will abort a sendf mid-send.
  2861.  
  2862.           Sendf  responds  appropriately   to   XOFF/XON   characters.
  2863.           However, when an interrupt drive serial port is  being  used
  2864.           (such as on the Tandy 2000 or COMBIOS on the IBM  PC),  then
  2865.           some problems may arise -- the buffering may cause Comsh not
  2866.           to be able to  throttle  its  output  quickly  enough.   The
  2867.           solution for this problem may be  to  write  a  script  that
  2868.           sends lines via "send" at a slower rate.
  2869.  
  2870.           EXAMPLES:
  2871.  
  2872.           sendf test.fil          <-- Sends test.fil, <CR>s only
  2873.           sendf -l test.fil       <-- Sends test.fil with <CRLF>s
  2874.  
  2875.           SEE ALSO:
  2876.                   send
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.  
  2901.                                      - 44 -
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.                                                          Commands: set
  2908.  
  2909.  
  2910.                                       set
  2911.  
  2912.  
  2913.           SYNTAX:
  2914.                   set
  2915.                   set <var> <arg>
  2916.                   set <option>
  2917.  
  2918.           DESCRIPTION:
  2919.  
  2920.           The set  command  serves  two  major  purposes.   The  first
  2921.           purpose is to set and review variable settings.  The  second
  2922.           purpose  is  to  control  certain  major   Comsh   operating
  2923.           conditions.
  2924.  
  2925.           In the first role, there are two major commands,  the  first
  2926.           of which is simply:
  2927.                   set
  2928.           This causes all defined variables to be displayed.
  2929.  
  2930.           The second form, "set <var> <arg>", allows you to define  or
  2931.           redefine variables.
  2932.  
  2933.           EXAMPLES (of variable manipulation):
  2934.  
  2935.           set foo "a test"        <-- Sets $foo to a test
  2936.           set huh now             <-- Sets $huh to now
  2937.           set yeh $foo            <-- Sets $yet to "a test"
  2938.  
  2939.           OPTIONS:
  2940.  
  2941.           The second role of the set command, as mentioned  above,  is
  2942.           to set certain major options.  Specifically, there  are  two
  2943.           classes of options.  The first class is the script debugging
  2944.           facility.  If you say:
  2945.                   set DEBUG
  2946.           then every line of executing scripts will be printed out  on
  2947.           the terminal as they are executed.  This is to allow you  to
  2948.           debug your scripts (obviously).  If you say:
  2949.                   set -DEBUG
  2950.           then the debuggin feature is disabled.
  2951.  
  2952.           The second class if set options are for selecting what  kind
  2953.           of terminal Comsh is emulating.  At the moment, Comsh  knows
  2954.           about three terminal types:
  2955.  
  2956.                   set VT52        <-- Emulate a VT52
  2957.                   set VIDTEX      <-- Emulate CIS's VIDTEX
  2958.                   set ANSI        <-- Respond to ANSI escape sequences
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.                                      - 45 -
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.           Commands: set
  2974.  
  2975.           If you plan upon using "set VT52", please see the note under
  2976.           "stty 24".
  2977.  
  2978.  
  2979.  
  2980.  
  2981.  
  2982.  
  2983.  
  2984.  
  2985.  
  2986.  
  2987.  
  2988.  
  2989.  
  2990.  
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.                                      - 46 -
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.                                                        Commands: sleep
  3040.  
  3041.  
  3042.                                      sleep
  3043.  
  3044.  
  3045.           SYNTAX:
  3046.                   sleep <time>
  3047.  
  3048.           DESCRIPTION:
  3049.  
  3050.           Sleep causes Comsh to do nothing for <time> seconds.
  3051.  
  3052.           A break-key will abort a sleep mid-slumber.
  3053.  
  3054.           If you want to have  Comsh  sleep  until  a  specific  time,
  3055.           rather than having it sleep for a specific amount  of  time,
  3056.           you can use the sleepuntil script described in  the  section
  3057.           on the "add" command.
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.                                      - 47 -
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.           Commands: stty
  3106.  
  3107.  
  3108.                                       stty
  3109.  
  3110.  
  3111.           SYNTAX:
  3112.                   stty <options>
  3113.  
  3114.           DESCRIPTION:
  3115.  
  3116.           The stty command is used  to  configure  the  communications
  3117.           parameters of Comsh.  Any or  all  of  the  options  may  be
  3118.           present.  The options, one by one, are:
  3119.  
  3120.                   <speed>
  3121.           Specifies the baud rate Comsh runs at.  Can be any baud rate
  3122.           supported  by  the  ROM  BIOS,  including  300   and   1200.
  3123.           Initially is "300".
  3124.  
  3125.                   [-]beep
  3126.           Specifies either that bell characters should  make  a  noise
  3127.           (beep), or that they should be surpressed (-beep).  -beep is
  3128.           useful for late night hacking or for politeness ... it  also
  3129.           comes in handy if you're fond of typing binary files.
  3130.  
  3131.                   [-]bsb
  3132.           Specifies whether backspaces should be destructive (bsb), or
  3133.           whether  they  should   be   non-desctructive   (-bsb).    A
  3134.           destructive backspace acts, in  effect,  like  the  sequence
  3135.           "backspace - space - backspace" (which is exactly how  Comsh
  3136.           does it).
  3137.  
  3138.                   [-]f
  3139.           Specifies "fudgemode", a not yet useful  option.   Initially
  3140.           is in non-fudgemode (-f).
  3141.  
  3142.                   [-]s
  3143.           Specifies whether you get to watch all  characters  received
  3144.           during sendfs, sleeps, and waits (stty s), or whether  these
  3145.           commands are quiet in their operation (stty -s).
  3146.  
  3147.                   [-]tt
  3148.           Specifies whether touch tone dialing should  be  used  (stty
  3149.           tt), or whether pulse dialing should be used (stty -tt).  Of
  3150.           course,  this  only  applies  to  hayes   smartmodems   (and
  3151.           compatibles).
  3152.  
  3153.                   [-]w
  3154.           Specifies whether terminal will respond to the VIDTEX switch
  3155.           to 40 column (wide) mode command.  CIS does  this  an  awful
  3156.           lot, and leaves terminals in 40 col mode when it  shouldn't.
  3157.           Initally is "-w", not allowing 40 column mode.
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.                                      - 48 -
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.                                                         Commands: stty
  3172.  
  3173.  
  3174.                   7 | 8
  3175.           Specifies whether 7 or 8 bit characters should be  used.   8
  3176.           bit characters allows  IBM  PC  graphics  characters  to  be
  3177.           received.  Initially set to 7.  Note that this  is  not  the
  3178.           transmitted and received word size, but whether Comsh "ands"
  3179.           all incoming data with 127 or not.  (see word7 | word8).
  3180.  
  3181.                   1 | 4
  3182.           Specifies whether Comsh tries to use one screen  exclusively
  3183.           (the "1" option), or will allow you to use (and it  to  use)
  3184.           four text screens (the "4" option).
  3185.  
  3186.                   24 | 25
  3187.           Specifies whether Comsh gives you a 25 line screen  (initial
  3188.           value) or a 24 line screen (stty 24).  There is one  primary
  3189.           use for this command:  when running in VT52  emulation  mode
  3190.           (see "set VT52"), you often need to have a 24 line screen to
  3191.           be fully compatible.  Thus, it may be necessary to say  both
  3192.           "stty 24" and "set VT52" to be fully VT52 compatible.
  3193.  
  3194.                   [-]echo
  3195.           Specifies whether the remote  host  is  echoing  characters.
  3196.           "-echo" means the remote host does not  echo,  "echo"  means
  3197.           the host does echo.  Initially set to "echo".
  3198.  
  3199.                   odd
  3200.                   even
  3201.                   none
  3202.           Each of these three (mutually exclusive) options selects the
  3203.           parity Comsh will use.  "none" is the initial choice.
  3204.  
  3205.                   word7
  3206.                   word8
  3207.           Word7 tells Comsh to transmit and receive 7 bit words, while
  3208.           word8 (the initial choice) tells Comsh to tranimit/receive 8
  3209.           bit words.
  3210.  
  3211.                   stop1
  3212.                   stop2
  3213.           Stop1  tells  Comsh  to  transmit/receive  1  stop  bit  per
  3214.           character, while stop2 tells Comsh to  transmit/receive  two
  3215.           stop bits per character. "stty stop1" is the initial value.
  3216.  
  3217.                   com1
  3218.                   com2
  3219.           Many IBM PCs have two serial ports, named "com1" and "com2".
  3220.           "stty com2" tells Comsh to talk to the world  via  the  com2
  3221.           port, while "stty com1" (the initial choice) tells Comsh  to
  3222.           talk via the com1 port.
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.                                      - 49 -
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.           Commands: stty
  3238.  
  3239.           EXAMPLES:
  3240.  
  3241.           stty 300 echo 4
  3242.  
  3243.           Means: Run at 300 baud, expect a remote echo, and allow  use
  3244.           of the four text screens of the CGA.
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.  
  3257.  
  3258.  
  3259.  
  3260.  
  3261.  
  3262.  
  3263.  
  3264.  
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.                                      - 50 -
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.                                                       Commands: switch
  3304.  
  3305.  
  3306.                                      switch
  3307.  
  3308.  
  3309.           SYNTAX:
  3310.                   switch <screen>
  3311.  
  3312.           DESCRIPTION:
  3313.  
  3314.           Switches the active screen to screen <screen>.   The  screen
  3315.           specified must be in the range 0..3.  Note that the "stty 4"
  3316.           command must have been given before the switch  command  has
  3317.           any effect.  If "stty 4" has not been executed, then  switch
  3318.           acts line a no-op.
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.                                      - 51 -
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.           Commands: wait
  3370.  
  3371.  
  3372.                                       wait
  3373.  
  3374.  
  3375.           SYNTAX:
  3376.                   wait [<max time>]
  3377.  
  3378.           DESCRIPTION:
  3379.  
  3380.           The wait command is used to wait  for  one  of  the  defined
  3381.           patterns (see patter command) to be  spotted  in  the  input
  3382.           stream.  If the <max time> argument is specified, wait  will
  3383.           wait no more than <max time> seconds before giving  up.   If
  3384.           the wait does give up, then pattern -1 is "matched" (See "if
  3385.           match" for more details).
  3386.  
  3387.           A break will cause a wait to terminate  early  (as  well  as
  3388.           stopping all scripts that are executing...).
  3389.  
  3390.           SEE ALSO:
  3391.                   if, pattern
  3392.  
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.                                      - 52 -
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.                                                           Commands: wc
  3436.  
  3437.  
  3438.                                        wc
  3439.  
  3440.  
  3441.           SYNTAX:
  3442.                   wc <file>
  3443.  
  3444.           DESCRIPTION:
  3445.  
  3446.           The wc command  reports  the  total  number  of  characters,
  3447.           words, and lines in the file <file>.
  3448.  
  3449.           EXAMPLE:
  3450.  
  3451.           When I said:
  3452.                   wc comsh.doc
  3453.           I was told:
  3454.                   4228 lines, 13917 words, 82019 chars
  3455.  
  3456.           (AAAAARRRRRRRGGGGGGGHHHHHHH! Did I type all that???)
  3457.  
  3458.           BUGS:
  3459.  
  3460.           wc isn't the quickest thing.   Don't  wc  if  you  need  the
  3461.           answer yesterday...
  3462.  
  3463.           I think wc counts <crlf> as one character.
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.  
  3495.                                      - 53 -
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.           Commands: wrapbuf
  3502.  
  3503.  
  3504.                                     wrapbuf
  3505.  
  3506.  
  3507.           SYNTAX:
  3508.                   wrapbuf <size>
  3509.  
  3510.           DESCRIPTION:
  3511.  
  3512.           Normally the capture buffer mechanism in  Comsh  will  start
  3513.           griping when the buffer gets close to  full  and  eventually
  3514.           closes itself when it is full.  It does  this  so  that  any
  3515.           data you have captured doesn't get lost (at the  expense  of
  3516.           new data arriving  after  the  capture  buffer  gets  full).
  3517.           However, you can tell Comsh to manage its capture buffer  so
  3518.           that it "scrolls" off the oldest data in favor of the newest
  3519.           data when it gets close to full.  Thus, the  capture  buffer
  3520.           won't close when it gets full -- it'll just dump the  oldest
  3521.           data to make room for the incoming data.
  3522.  
  3523.           The wrapbuf command is used to effect a  transition  between
  3524.           these two modes of operation.   If you say:
  3525.                   wrapbuf 0
  3526.           Comsh will act in the normal, default  way  --  closing  the
  3527.           capture buffer when it gets full.   But,  if  you  say  (for
  3528.           example):
  3529.                   wrapbuf 10000
  3530.           Comsh will keep the  ten  thousand  most  recently  received
  3531.           characters in the capture buffer.  Any number  between  (but
  3532.           not including) 0 and  $SIZE-4096  will  work  well  for  the
  3533.           wrapbuf factor.  if you pick  something  between  $SIZE-4096
  3534.           and  $SIZE,  you'll  encounter  the  "buffer  getting  full"
  3535.           warnings when you first start to fill the buffer (let's call
  3536.           this a ``feature'').
  3537.  
  3538.           The reset command sets the wrapbuf factor back to  zero,  so
  3539.           be careful.
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.                                      - 54 -
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.                                                        Commands: write
  3568.  
  3569.  
  3570.                                      write
  3571.  
  3572.  
  3573.           SYNTAX:
  3574.                   write <file>
  3575.  
  3576.           DESCRIPTION:
  3577.  
  3578.           The write command writes the contents of the capture  buffer
  3579.           out to the file <file>.  The write command actually  appends
  3580.           the capture buffers contents to the file,  so  that  if  the
  3581.           file already exists  the  old  contents  will  be  preserved
  3582.           (though extended a bit).  A destructive write can be had  by
  3583.           saying:
  3584.  
  3585.                   rm <file> ; write <file>
  3586.  
  3587.           If you're really lazy,  you  could  even  put  that  into  a
  3588.           script...
  3589.  
  3590.           SEE ALSO:
  3591.                   close, open, reset
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.                                      - 55 -
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.           Commands: xmodem
  3634.  
  3635.  
  3636.                                      xmodem
  3637.  
  3638.  
  3639.           SYNTAX:
  3640.                   xmodem <option> <file>
  3641.  
  3642.           DESCRIPTION:
  3643.  
  3644.           The xmodem command is used to initiate  an  xmodem  transfer
  3645.           between the local and remote computers.  The options are:
  3646.  
  3647.                   -s              <-- Send the file <file>
  3648.                   -rb             <-- Receive the file <file> / binary
  3649.                   -rt             <-- Receive the file <file> / text
  3650.  
  3651.           The difference between the -rb and -rt options is  that  the
  3652.           -rt  option  causes  all  control-Zs  (CPM   end   of   file
  3653.           characters) to be swallowed and not writen out to the  file.
  3654.           This is useful, as MSDOS keeps an exact character  count  of
  3655.           file sizes and so ^Zs are wasteful.
  3656.  
  3657.           Notes on using xmodem with CIS:
  3658.  
  3659.           Normally, there is no reason to  do  xmodem  file  transfers
  3660.           to/from CIS; the A protocol works better.  However if you do
  3661.           try xmodem with CIS, be advised that there  exists  (at  the
  3662.           time of this writing) a minor  incompatibility  between  CIS
  3663.           and Comsh.  Comsh pads the last record  transmitted  to  CIS
  3664.           with control Zs, while CIS expects  to  see  records  padded
  3665.           with nulls.  Thus, text files uploaded to CIS often  end  up
  3666.           with lots of control Zs at the end --  an  annoying,  though
  3667.           mostly  harmless  condition.   Other  modem  programs  (like
  3668.           "umodem" under Unix) will strip control Zs from text files.
  3669.  
  3670.  
  3671.  
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.  
  3680.  
  3681.  
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.                                      - 56 -
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.                                                    Commands: : <label>
  3700.  
  3701.  
  3702.                                    : <label>
  3703.  
  3704.  
  3705.           SYNTAX:
  3706.                   : <label>
  3707.  
  3708.           DESCRIPTION:
  3709.  
  3710.           This  is  the  format  for  a  target  of  a  goto  or   if.
  3711.           Specifically, a label consists of a colon  (:)  followed  by
  3712.           *one* space ( ) followed by the actual label.
  3713.  
  3714.           Labels also have another use  in  scripts.   Labels  can  be
  3715.           cleverly used to insert comments into a script:  When  Comsh
  3716.           encounters a label in  the  middle  of  a  script,  it  just
  3717.           ignores it (that  is,  any  line  starting  with  a  ":"  is
  3718.           ignored).  So, you can stick labels like:
  3719.                   : Start of script foobar
  3720.           in the middle of scripts, and they'll have no  effect,  save
  3721.           for the delay it takes to read the next line of the script.
  3722.  
  3723.  
  3724.  
  3725.  
  3726.  
  3727.  
  3728.  
  3729.  
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.  
  3737.  
  3738.  
  3739.  
  3740.  
  3741.  
  3742.  
  3743.  
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.                                      - 57 -
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.           Scripts
  3766.  
  3767.  
  3768.  
  3769.                                     Scripts
  3770.  
  3771.  
  3772.           [Introduction]
  3773.  
  3774.  
  3775.           One of COMSH's most powerful  features  is  the  ability  to
  3776.           write "programs" in a simple interpretive  language.   These
  3777.           programs, better called scripts, are simply lists  of  COMSH
  3778.           commands to execute, and use COMSH's very  simple  branching
  3779.           ability.
  3780.  
  3781.           [How do scripts get invoked?]
  3782.  
  3783.           Whenever COMSH receives an illegal command (either from  you
  3784.           or another script), it checks to see if there is a  file  of
  3785.           the form <command>.csh on the default drive in  the  default
  3786.           directory (Dos 2).  If there is such a  (text)  file,  COMSH
  3787.           then reads commands from  this  file  instead  of  from  the
  3788.           terminal.
  3789.  
  3790.           [Arguments to scripts]
  3791.  
  3792.           Scripts can accept up to 9 arguments (see discussion in  the
  3793.           introductory section).  The arguments, $1  through  $9,  are
  3794.           local to the script, and  are  preserved  through  calls  to
  3795.           other scripts.
  3796.  
  3797.           [Commands in scripts]
  3798.  
  3799.           All of the commands used by scripts  are  described  in  the
  3800.           commands section of this  document  --  and  some  of  those
  3801.           commands (if, goto, : <label>) are intended specifically for
  3802.           use within scripts.
  3803.  
  3804.           As  the  commands  that  can  be  used  have  already   been
  3805.           described, this section will present  some  example  scripts
  3806.           with detailed explanations in hope of  conveying  the  power
  3807.           and flavor of scripts.
  3808.  
  3809.           [Stopping Scripts on a dime]
  3810.  
  3811.           If, while you are executing a script, you don't line the way
  3812.           things are going,  hitting  the  break  key  (control-scroll
  3813.           lock) will stop *all* executing scripts and  return  you  to
  3814.           command more or communicatons mode (depending upon where you
  3815.           were when you started the command).
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.                                      - 58 -
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.                                                                Scripts
  3832.  
  3833.           [who.csh]
  3834.  
  3835.           The "who" command, as implemented in a script, is useful for
  3836.           maintaining  an  online  database  of  people's  names   and
  3837.           accounts.  Specifically, the format of the script is either:
  3838.  
  3839.                   who <pattern>
  3840.           or:
  3841.                   who -add
  3842.  
  3843.           The first form looks for the <pattern>  in  both  names  and
  3844.           ppns, allowing you to say something like:
  3845.                   who Charles
  3846.           and:
  3847.                   who 76703,373
  3848.  
  3849.           The second form  of  the  command  is  used  when  you  have
  3850.           somebody's name and account to  add  to  the  database;  the
  3851.           script then prompts for the necessary information.
  3852.  
  3853.           The database is kept in the file "who.dat" in the form:
  3854.  
  3855.           <account><tab><name>
  3856.  
  3857.           -- each line of the file has one entry giving  the  person's
  3858.           account and name.
  3859.  
  3860.           Following  is  the  actual  script  along  with  a  detailed
  3861.           discussion of its operation:
  3862.  
  3863.  
  3864.                if !same $$ 2 usage
  3865.                if !fexist who.dat nodata
  3866.                if same $1 -add addname
  3867.                grep $1 who.dat
  3868.                goto end
  3869.                : usage
  3870.                echo "usage: who <ppn> | <name> | -add"
  3871.                goto end
  3872.                : nodata
  3873.                echo "no file who.dat to search"
  3874.                goto end
  3875.                : addname
  3876.                echo -n "PPN to add:"
  3877.                read 1
  3878.                echo -n "Name to add:"
  3879.                read 2
  3880.                apl who.dat $1 "\i" $2
  3881.                goto end
  3882.                : end
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.                                      - 59 -
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.           Scripts
  3898.  
  3899.  
  3900.           The first line of the script checks to see if the number  of
  3901.           arugments passed (which is in the variable "$$") is equal to
  3902.           two (note that the name of  the  script,  which  is  in  the
  3903.           variable $0, counts as one argument).  If there are not  two
  3904.           arguments, the script branches to the label  "usage",  which
  3905.           will print out a message saying how to use the script.
  3906.  
  3907.           The second line of the script checks  to  see  of  the  file
  3908.           "who.dat" exists.  This file is the database of accounts and
  3909.           names, and if it is not present the script  cannot  look  up
  3910.           names.  If the file does not exist (!fexist),  a  branch  is
  3911.           taken to the label  "nodata",  where  a  message  about  the
  3912.           missing file is printed.
  3913.  
  3914.           The third line of the script checks to see if  the  argument
  3915.           to the script is "-add" -- indicating that the user does not
  3916.           want to look up an account, but rather to add one.   If  the
  3917.           argument matches "-add", a branch  is  taken  to  "addname",
  3918.           where the name and account  number  will  be  added  to  the
  3919.           database.
  3920.  
  3921.           The fourth line  actually  performs  the  search  using  the
  3922.           "grep" command which is built into COMSH.  Grep will  report
  3923.           any matches found in the database.
  3924.  
  3925.           The fifth line branches  to  a  common  end  point;  scripts
  3926.           terminate by falling off the end.
  3927.  
  3928.           Lines six, seven, and eight are the usage reminder.  Six  is
  3929.           the target of the if branch; seven prints  out  the  message
  3930.           giving the correct syntax for who; and eight braches to  the
  3931.           end of the script.
  3932.  
  3933.           Lines nine, ten, and eleven provide the message  when  there
  3934.           is no "who.dat" file.  Nine is the target of the  if  branch
  3935.           from earlier in the script; ten prints the message out;  and
  3936.           eleven braches to the end.
  3937.  
  3938.           Line twelve is the label for the add new name routine.
  3939.  
  3940.           Line thirteen prints out a prompt asking for the ppn to  add
  3941.           to the database; the "-n" argument causes  "echo"  to  *not*
  3942.           output a CRLF at the end of the message so that  the  user's
  3943.           response will be on the same line as the prompt.
  3944.  
  3945.           Line fourteen causes COMSH to read a line of input  in  from
  3946.           the user and store it in variable 1 (which also  happens  to
  3947.           be a local variable, and points out that local variables can
  3948.           be re-assigned).
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.                                      - 60 -
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.                                                                Scripts
  3964.  
  3965.           Line fifteen prints out the prompt asking for  the  name  to
  3966.           add to the database; again, the "-n" argument  prevents  the
  3967.           CRLF from following the message.
  3968.  
  3969.           Line sixteen reads one line of input in from  the  user  and
  3970.           assigns it to local variable 2; thus, $2 will have the  name
  3971.           of the user to add to the database.
  3972.  
  3973.           Line seventeen actually updates  the  database.   The  "apl"
  3974.           command appends one line of text to a  specified  text  file
  3975.           (in this case "who.dat").  The line following the file  name
  3976.           ($1 \i $2) is expanded out to be "<ppn><tab><name>".
  3977.  
  3978.           Line eighteen takes a short branch to line  nineteen,  which
  3979.           is the end of the script.
  3980.  
  3981.  
  3982.  
  3983.  
  3984.  
  3985.  
  3986.  
  3987.  
  3988.  
  3989.  
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.                                      - 61 -
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.           Scripts
  4030.  
  4031.           [dialx]
  4032.  
  4033.           The "dialx"  script  is  used  to  repetitively  dial  phone
  4034.           numbers (like bbses) so that you can  (we  hope)  eventually
  4035.           get through to them.  The syntax for dialx is:
  4036.  
  4037.                   dialx <delay> <name> [<ld-service>]
  4038.  
  4039.           The first argument, <delay>, tells how long to pause between
  4040.           redials and is given in seconds.  The second  two  arguments
  4041.           are exacty the same as supplied to the "dial" command, viz.,
  4042.           the name of  the  computer  you  are  trying  to  dial  and,
  4043.           optionally, the long distance carrier to use.
  4044.  
  4045.           The source of dialx is:
  4046.  
  4047.                : dial to get thru to a busy number
  4048.                : dialx <delay> <number> [<service>]
  4049.                pattern reset
  4050.                pattern 0 "NO CARRIER"
  4051.                pattern 1 "CONNECT"
  4052.                : dodial
  4053.                if same $$ 4 longdial
  4054.                if !same $$ 3 usage
  4055.                echo Dialing $2
  4056.                dial $2
  4057.                goto well?
  4058.                : longdial
  4059.                dial $2 $3
  4060.                : well?
  4061.                wait 45
  4062.                if match 1 end
  4063.                echo Didn't get thru...
  4064.                sleep $1
  4065.                goto dodial
  4066.                : usage
  4067.                echo usage: dialx <delay> <number> [<service>]
  4068.                : end
  4069.  
  4070.  
  4071.           The first two lines are "labels", but never  used  as  such.
  4072.           Since COMSH ignores labels when it runs  across  them  (only
  4073.           paying attention when it is looking  for  a  specific  one),
  4074.           labels make cheap ways to insert comments into a script.
  4075.  
  4076.           The next three lines are used  to  initialize  the  patterns
  4077.           used by this script.  For reference, the Hayes  smart  modem
  4078.           returns one of two messages when you  try  to  dial  another
  4079.           computer with it:
  4080.                   CONNECT
  4081.           if you succeed, and
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.                                      - 62 -
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.                                                                Scripts
  4096.  
  4097.                   NO CARRIER
  4098.           if you fail.  Thus, two patterns are declared, one for  each
  4099.           possible outcome.  The pattern reset command gets rid of any
  4100.           other patterns that may happen to  be  already  declared  to
  4101.           COMSH, thus preventing errant pattern matches.  (If  pattern
  4102.           2, for example, was matching for  "CON",  it  would  succeed
  4103.           before pattern 0 did, greatly confusing this script.).
  4104.  
  4105.           Once the patterns have been initialized, the script  decides
  4106.           how many arguments have been passed and thus whether to  use
  4107.           a long distance dialing service.  If it finds four arguments
  4108.           (script name, pause dealy, number, LD-service), it  branches
  4109.           to the "longdial" routine.  If it finds not four (by falling
  4110.           through the if) and not three arguments (by  taking  the  if
  4111.           !same branch), it then goes to a usage message routine.
  4112.  
  4113.           Depending upon the type of call, one of two routines  passes
  4114.           the phone number off to the "dial" command,  which  actually
  4115.           instructs the  modem  to  dial  the  number.   Both  dialing
  4116.           routines, then, branch to a common  wait  and  see  routine,
  4117.           which waits for up to 45 seconds for one of the two patterns
  4118.           to be matched.  If the "CONNECT"  pattern  is  matched,  the
  4119.           script terminates and  the  user  is  (presumably)  left  to
  4120.           access the remote computer.  If the "NO CARRIER" pattern  is
  4121.           matched -- or if nothing is heard  from  the  modem  for  45
  4122.           seconds -- the script branches to a wait  routine  where  it
  4123.           "sleep"s for the time specified by  the  user  --  and  then
  4124.           tries to make the call again.
  4125.  
  4126.  
  4127.  
  4128.  
  4129.  
  4130.  
  4131.  
  4132.  
  4133.  
  4134.  
  4135.  
  4136.  
  4137.  
  4138.  
  4139.  
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.                                      - 63 -
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.           Comsh and CIS
  4162.  
  4163.  
  4164.  
  4165.                                  Comsh and CIS
  4166.  
  4167.  
  4168.           [Introduction]
  4169.  
  4170.           Comsh is, first and foremost, a terminal program meant to be
  4171.           used  with  the   CompuServe   Information   and   Executive
  4172.           Information Services.  Many of the tricks Comsh performs are
  4173.           not in response to a user command,  but  in  response  to  a
  4174.           command send from CIS.  In this section,  a  description  of
  4175.           what Comsh does in conjunction with CIS is given.
  4176.  
  4177.           [Cursor Positioning]
  4178.  
  4179.           One of the simpler things  Comsh  does  is  respond  to  the
  4180.           standard VIDTEX  cursor  positioning  and  screen  clearning
  4181.           commands.  Thus, Comsh is able to present menus nicely, play
  4182.           screen oriented games, and generally make full  use  of  the
  4183.           services available on CIS/EIS.
  4184.  
  4185.           [Graphics]
  4186.  
  4187.           Comsh supports the medium and high resolution graphics  that
  4188.           CIS/EIS is capable of generating.  At the moment,  the  only
  4189.           software CIS has to generate graphics  (beyond  pure  demos)
  4190.           are the high-res  radar  maps  (GO  AWX-4),  and  the  stock
  4191.           plotting routines in MicroQuote.  Note that you  don't  have
  4192.           to tell Comsh anything to get it into graphics  modes;  when
  4193.           CIS tells it to  plot,  Comsh  plots.   Of  course,  if  you
  4194.           *don't* have a graphics display adapter, things aren't going
  4195.           to look too pretty...
  4196.  
  4197.           [File Transfers]
  4198.  
  4199.           Comsh supports the CIS A-protocol for file transfers.   When
  4200.           you are in an XA (or public access) database, and  give  the
  4201.           UPL or DOW commands (or pick DOW off of a menu), you will be
  4202.           asked (by CIS) for the name of the file to transfer to/from.
  4203.           This filename is the name of the file on your computer  that
  4204.           will be used; CIS transmits this name to COMSH, who in  turn
  4205.           either uploads the file to CIS or  downloads  it  from  CIS.
  4206.           During the file transfer, Comsh prints out  frequent  status
  4207.           messages so you know that everything is  proceding  smoothly
  4208.           (or so that you know things aren't...).
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.                                      - 64 -
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.                                                          Comsh and CIS
  4228.  
  4229.